package com.mingqijia.gassafety.authority.api.web.facade;

import com.mingqijia.gassafety.authority.api.req.company.CompanyThirdPartyDTO;
import com.mingqijia.gassafety.authority.api.req.company.CreateCompanyReqDTO;
import com.mingqijia.gassafety.authority.api.req.company.QueryCompanyReqDTO;
import com.mingqijia.gassafety.authority.api.req.company.UpdateCompanyReqDTO;
import com.mingqijia.gassafety.authority.api.resp.company.CompanyLiteRespDTO;
import com.mingqijia.gassafety.authority.api.resp.company.CompanyRespDTO;
import com.mingqijia.gassafety.shared.utils.commonUtils.PageUtil;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiImplicitParam;
import io.swagger.annotations.ApiImplicitParams;
import io.swagger.annotations.ApiOperation;
import org.springframework.http.MediaType;
import org.springframework.web.bind.annotation.*;

import javax.validation.Valid;
import java.util.List;

/**
 * REST接口
 * @author Damon S.
 * @version v0.2
 * @date 2021-06-19
 */
@Api(tags = "控制台--企业")
@RequestMapping(value = "/console/v1/companies", produces = MediaType.APPLICATION_JSON_VALUE)
public interface CompanyManageFacade {

    @GetMapping("/all")
    @ApiOperation(value = "获取所有企业", notes = "获取所有企业")
    PageUtil<CompanyLiteRespDTO> findAll();

    @GetMapping("/vccall")
    @ApiOperation(value = "获取所有VCC企业", notes = "获取所有VCC企业")
    List<CompanyRespDTO> findVccOrgs();

    @GetMapping
    @ApiOperation(value = "查询企业", notes = "返回企业列表")
    PageUtil<CompanyRespDTO> find(@Valid QueryCompanyReqDTO req);

    @GetMapping("/{spId}/thirdparty")
    @ApiImplicitParam(name = "spId", value = "企业Id", dataType = "String")
    @ApiOperation(value = "获取第三方系统", notes = "返回第三方系统信息")
    CompanyThirdPartyDTO find(@PathVariable String spId);

    @PostMapping("/{spId}/thirdparty")
    @ApiImplicitParam(name = "spId", value = "企业Id", dataType = "String")
    @ApiOperation(value = "新增/修改第三方系统", notes = "返回是否成功")
    void create(@RequestBody@Valid CompanyThirdPartyDTO req);

    @PostMapping
    @ApiOperation(value = "新增企业", notes = "返回是否创建成功")
    String create(@RequestBody@Valid CreateCompanyReqDTO req);

    @PutMapping
    @ApiOperation(value = "更新企业", notes = "返回是否更新成功")
    void update(@RequestBody@Valid UpdateCompanyReqDTO req);

    @DeleteMapping("/{spId}")
    @ApiImplicitParam(name = "spId", value = "企业Id", dataType = "String")
    @ApiOperation(value = "删除企业", notes = "返回是否删除成功")
    void remove(@PathVariable String[] spId);

    @PutMapping("/{spId}/{state}")
    @ApiImplicitParams({
            @ApiImplicitParam(name = "spId", value = "企业Id", dataType = "String"),
            @ApiImplicitParam(name = "state", value = "启用状态", dataType = "String")
    })
    @ApiOperation(value = "企业上下线(0停用，1启用)", notes = "返回是否成功")
    void switchCompany(@PathVariable String spId, @PathVariable Integer state);
}
